package com.example.testapplication;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;

import androidx.annotation.Nullable;

import com.example.testapplication.adapter.ChapterAdapter;
import com.example.testapplication.bean.Chapter;
import com.example.testapplication.bean.ChapterLab;

import java.util.ArrayList;
import java.util.List;

public class ExpandableListViewActivity extends ApplicationActivity{
    private ExpandableListView mExpandaleListView;
    private BaseExpandableListAdapter mAdapter;
    private List<Chapter> mDatas = new ArrayList<>();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_expand);

        initViews();
    }

    private void initViews() {
        mExpandaleListView = findViewById(R.id.id_expandableListView);
        mDatas.clear();
        // 模拟数据
        mDatas.addAll(ChapterLab.generateDatas());
        mAdapter = new ChapterAdapter(this,mDatas);


    }
}
